cmake_minimum_required(VERSION 3.10.2)
project(mock)

set(CMAKE_CXX_STANDARD 17)
#set(CMAKE_CXX_FLAGS "-std=c++1y -fno-rtti -fvisibility=default -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS "-std=c++1y -fno-rtti -fvisibility=default -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fpic -fdata-sections -ffunction-sections -D_GLIBC_MOCK")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-Bsymbolic -Wl,--no-as-needed -ldl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-macro-redefined -Wno-constant-conversion -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types")
add_definitions(-DNDEBUG=1 -DHAVE_USLEEP=1 -DSQLITE_HAVE_ISNAN -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576)
add_definitions(-DSQLITE_THREADSAFE=2 -DSQLITE_TEMP_STORE=3 -DSQLITE_POWERSAFE_OVERWRITE=1)
add_definitions(-DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_DEFAULT_AUTOVACUUM=1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1)
add_definitions(-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS4 -DSQLITE_OMIT_COMPILEOPTION_DIAGS)
add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 -DSQLITE_SECURE_DELETE)
add_definitions(-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE -DUSE_PREAD64 -Dfdatasync=fdatasync -DSQLITE_CODEC_ATTACH_CHANGED)
add_definitions(-DHAVE_MALLOC_H=1 -DHAVE_MALLOC_USABLE_SIZE -DSQLITE_DIRECT_OVERFLOW_READ -DSQLITE_HAS_CODEC -DSQLITE_EXPORT_SYMBOLS)
add_definitions(-DSQLITE_HAS_CODEC -DSQLITE3_HW_EXPORT_SYMBOLS -DSQLITE_HW_SHARED_BLOCK_OPTIMIZATION)
add_definitions(-DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DNDEBUG -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RIPEMD)
add_definitions(-DL_ENDIAN -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DWINDOWS_PLATFORM -DSQLITE_ENABLE_DROPTABLE_CALLBACK)
add_definitions(-DNAPI_EXPERIMENTAL -DSQLITE_DISTRIBUTE_RELATIONAL)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src mockSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/sqlite/src mockSrc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/napi)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/napi/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/uapi)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sqlite/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../utils_native/base/include)
set(MOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR})
include(${CMAKE_CURRENT_SOURCE_DIR}/include/CMakeLists.txt OPTIONAL)

set(links secure crypto)
add_library(mock SHARED ${mockSrc})
target_link_libraries(mock ${links})
